#include<stdio.h>
#include<stdlib.h>
#include <cmath> 
#include <time.h>
int i;
double polynom(double x, double a[], int n)
	{
		double m;
		double s=a[0];
		m=1;
		for(i=1; i<n+1; i++)
			{
				m=m*x;
				s=s+(a[i]*m);
			}
		return s;
	}
void main()
{
	int rn, b, n, check;
	double a[1000], x;
	printf("Enter degree of a polynomial:\n");
	check=scanf("%d", &n);
	if(check!=1)
		{
			printf("Wrong input!\n");
			return;
		}
	printf("Enter argument value:\n");
	check=scanf("%lf", &x);
	if(check!=1)
		{
			printf("Wrong input!\n");
			return;
		}
	printf("Enter constant coefficients from A(0) to A(N):\n");
	for(i=0; i<n+1; i++)
		{
			check=scanf("%lf", &a[i]);
			if(check!=1)
				{
					printf("Wrong input!\n");
					return;
				}
		}
	printf("Polynomial value: %lf\n", polynom(x, a, n));
	system("PAUSE");
}